//
//  ImageLoader.swift
//  JLCommonKit
//
//  Created by Jiang Chencheng on 2024/8/1.
//

import Foundation
import UIKit


public protocol ImageLoadable: AnyObject {
    static var bundle: Bundle { get }
    
    static func image(name: String) -> UIImage
}

public extension ImageLoadable {
    @available(iOS 11.0, *)
    static func image(name: String) -> UIImage {
        guard let image = UIImage(named: name, in: bundle, compatibleWith: nil) else {
            fatalError("\(name) image not found in \(bundle)")
        }
        return image
    }
}
